package com.nine.news.modular.user.controller;

import com.nine.news.modular.user.param.UserLogonCodeParam;
import com.nine.news.modular.user.service.SmsService;
import com.nine.news.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: szhan
 * @Date: 2023/03/24/8:25 AM
 * @Description:
 */
@RestController
@RequestMapping("api/sms")
@Api(tags = "短信模块")
public class SmsController {
    @Resource
    private SmsService service;

    @ApiOperation(value = "发送注册验证码")
    @GetMapping("sendrcode")
    public R sendRcode(@RequestParam("phone") String phone){
        return service.sendRcode(phone);
    }

    @ApiOperation(value = "校验注册验证码")
    @PostMapping("checkrcode")
    public R checkRcode(@RequestBody UserLogonCodeParam param ){
        return service.checkRcode(param);
    }

    @ApiOperation(value = "查询发送记录")
    @GetMapping("all")
    public R all(){
        return service.all();
    }

    @ApiOperation(value = "发送登录验证码")
    @GetMapping("sendlcode")
    public R sendLcode(String phone){
        return service.sendLcode(phone);
    }

    @ApiOperation(value = "发送密码找回验证码")
    @GetMapping("sendfcode")
    public R sendFcode(String phone){
        return service.sendFcode(phone);
    }

    @ApiOperation(value = "校验密码找回验证码")
    @PostMapping("checkfcode")
    public R checkFcode(@RequestBody UserLogonCodeParam param){
        return service.checkFcode(param);
    }
}
